refactor(auth): JWT ライブラリを python-jose から PyJWT へ移行し ecdsa 脆弱性を解消#481
Conversation
python-jose の推移的依存 ecdsa 0.19.2 に修正版の出ない脆弱性 (PYSEC-2026-1325 / Minerva タイミング攻撃・P-256)があり、pip-audit が 全 PR・main 共通で fail していた。DevForge の JWT は RS256 のみで cryptography バックエンドを使い ecdsa 経路は未使用のため、PyJWT[crypto] へ移行して ecdsa 依存自体を除去する。 - auth.py: jose.JWTError → jwt.PyJWTError(RS256 の署名・検証挙動は不変) - requirements.txt: python-jose[cryptography]==3.5.0 → PyJWT[crypto]==2.13.0 - THIRD_PARTY_LICENSES.md を make licenses で再生成 - README / auth-security.md の JWT ライブラリ表記を更新 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThe JWT library dependency is migrated from python-jose to PyJWT throughout the backend. The auth module's import and exception handling are updated to use jwt.PyJWTError, tests are adjusted, and requirements.txt, README, third-party license list, and internal rules documentation are updated accordingly. ChangesJWT Library Migration
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
背景
python-jose[cryptography]の推移的依存ecdsa 0.19.2に修正版の出ない脆弱性PYSEC-2026-1325(Minerva タイミング攻撃・P-256、CVSS 7.4)が存在し、CI のpip-auditが 全オープン PR・main 共通で fail していた。メンテナが「サイドチャネルは対象外」として修正しない方針のためrequirements.txtの「バージョン引き上げ」運用が使えない。対応
DevForge の JWT は RS256 のみ(
app/core/security/auth.py)でpython-joseは cryptography バックエンドを使い、ecdsa経路(ecdsa.SigningKey.sign_digest())は一切通らない。そのため脆弱性は実質非該当だが、依存ツリーから消すのが最もクリーンと判断しPyJWT[crypto]へ移行してecdsa依存自体を除去する。auth.py:jose.JWTError→jwt.PyJWTError(RS256 の署名・検証挙動は不変)requirements.txt:python-jose[cryptography]==3.5.0→PyJWT[crypto]==2.13.0THIRD_PARTY_LICENSES.mdをmake licensesで再生成README.md/.claude/rules/backend/auth-security.mdの JWT ライブラリ表記を更新検証
pip-audit -r requirements.txt→ No known vulnerabilities found(ecdsa がツリーから消失)make cifull green影響範囲
このマージ後、blocker が解消されるため滞留中の Renovate PR(#466 / #467 / #468 / #470)も緑化してマージ可能になる。
🤖 Generated with Claude Code
Summary by CodeRabbit
Chores
Documentation